﻿Public Partial Class ClickThrough
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ' Get Click Through Advertisement ID
        Dim advertisementID As Integer

        ' Try to get an advertisementID from the query string
        If Int32.TryParse(Request.QueryString.Item("ID"), advertisementID) Then
            Dim manager As New DotNetCore.BannerManagement.BLL.ClickThroughManager
            manager.InsertClickThrough(advertisementID)

            Dim adManager As New DotNetCore.BannerManagement.BLL.AdvertisementManager
            Dim ad As Domain.dnc_Advertisement = adManager.GetAdvertisementByID(advertisementID)

            ' Redirect to the advertisers web site
            Response.Redirect(ad.URL)
        Else
            ' Redirect no where as this was an invalid request
            Response.Redirect("")
        End If


    End Sub

End Class